package it.fuzzylogics.fuzzywidgetsLibrary.client.FuzzyPNGImage;

import com.google.gwt.user.client.ui.HTML;


public class FPNGImage extends HTML {
    String url;
    int width, height;

    public FPNGImage(String url) {
        this.url = url;

    }

    public FPNGImage(String url, int w, int h)//for compatibility
    {
        this.url = url;

    }

    public FPNGImage()//for compatibility
    {


    }


    public void setUrl(String url) {
        this.url = url;
        updateHTML();
    }

    public void setUrl(String url, int width, int height) {
        this.width = width;
        this.height = height;
        this.url = url;
        updateHTML();
    }

    public String getUrl() {
        return this.url;
    }

    public void setPixelSize(int width, int height) {
        this.width = width;
        this.height = height;
        // super.setPixelSize(width,height);

        updateHTML();


    }

    private void updateHTML() {
        String html = "<span style=\"width:" + width + "px;height:" + height + "px;display:inline-block;" +
                "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + url + "',sizingMethod='scale');\"><img style=\"" +
                "filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);" +
                "\" src=\"" + url + "\" width=\"" + width + "\" height=\"" + height + "\" border=\"0\" alt=\"\"></span>";
        setHTML(html);
    }


}